package com.yx.pc.api.service.impl;

import com.yx.common.utils.Query;
import com.yx.pc.api.service.PcTdCollectionService;
import com.yx.system.dao.TdCollectionMapper;
import com.yx.system.entity.TdCollection;
import com.yx.system.service.TdCollectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class PcTdCollectionServiceImpl implements PcTdCollectionService {

    @Autowired
    private TdCollectionMapper tdCollectionMapper;

    @Override
    public void deleteByPrimaryKey(Integer ids[]) {
        for (int i =0;i<ids.length;i++){
            tdCollectionMapper.updateByDeleteOperate(ids[i]);
        }
    }

    @Override
    public int insert(TdCollection record) {
        return tdCollectionMapper.insert(record);
    }

    @Override
    public int insertSelective(TdCollection record) {
        return tdCollectionMapper.insertSelective(record);
    }

    @Override
    public TdCollection selectByPrimaryKey(Integer id) {
        return tdCollectionMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(TdCollection record) {
        return tdCollectionMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(TdCollection record) {
        return tdCollectionMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<TdCollection> queryList(Map<String, Object> map) {
        return tdCollectionMapper.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return tdCollectionMapper.queryTotal(map);
    }

    @Override
    public List<TdCollection> isCollection(Map<String, Object> map) {
        return tdCollectionMapper.isCollection(map);
    }


    @Override
    public TdCollection findByBookidAndUserUUIDAndExist(String uuid, Integer bookid) {
        return tdCollectionMapper.findByBookidAndUserUUIDAndExist(uuid,bookid);
    }

    @Override
    public List<TdCollection> queryList1(Query query) {
        return tdCollectionMapper.queryList1(query);
    }

    @Override
    public int queryTotal1(Query query) {
        return tdCollectionMapper.queryTotal1(query);
    }

    @Override
    public TdCollection findByBookidAndUserUUIDAnddelete(String uuid, Integer bookid) {
        return tdCollectionMapper.findByBookidAndUserUUIDAnddelete(uuid,bookid);
    }

    @Override
    public Integer findTotalByUseruuid(String uuid) {
        return tdCollectionMapper.findTotalByUseruuid(uuid);
    }

    @Override
    public TdCollection findByUserAndBook(String uuid, Integer bookid) {
        return tdCollectionMapper.findByUserAndBook(uuid,bookid);
    }


}
